<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8" >
    <meta http-equiv="X-UA-Compatible" content="IE=11,IE=10,IE=9,IE=8" >
    <meta name="baidu-site-verification" content="dIcXMeY8Ya" />
    
    <title>基于XML的DI-02 | 即将拥有人鱼线丶</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" >
    <meta name="keywords" content="FutaoSmile, 前端, Web, 付韬, 个人博客" >
    <meta name="description" content="付韬FutaoSmile" >

    
    <link rel="alternative" href="/atom.xml" title="即将拥有人鱼线丶" type="application/atom+xml" >
    
    
    <link rel="shortcut icon" href="/coder957/coder957/favicon.ico" >
    
    <link rel="stylesheet" href="/coder957/css/style.css">
    <!--[if lt IE 9]>
    <script src="/coder957/js/html5.js"></script>
    <![endif]-->
    
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?fd459238242776d173cdc64918fb32f2";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>


</head>

<body class="home">
    <!--[if lt IE 9]>
    <div class="browsehappy">
        当前网页 <strong>不支持</strong>
        你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>.
    </div>
    <![endif]-->

    <!-- 博客头部 -->
    <header class="header">
    <section class="container header-main">
        <div class="logo">
            <a href="/coder957/">
                <div class="cover">
                    <span class="name">即将拥有人鱼线丶</span>
                    <span class="description">FutaoSmile</span>
                </div>
            </a>
        </div>
        <div class="dropnav icon-paragraph-justify" id="JELON__btnDropNav"></div>
        <ul class="menu hidden" id="JELON__menu">
            
                <li rel="/coder957/2017/10/10/基于XMl的DI-02/index.html" class="item ">
                    <a href="/coder957/" title="首页" class="icon-home">&nbsp;首页</a>
                </li>
                
                <li rel="/coder957/2017/10/10/基于XMl的DI-02/index.html" class="item ">
                    <a href="/coder957/lab/" title="实验室" class="icon-lab">&nbsp;实验室</a>
                </li>
                
                <li rel="/coder957/2017/10/10/基于XMl的DI-02/index.html" class="item ">
                    <a href="/coder957/about/" title="关于" class="icon-about">&nbsp;关于</a>
                </li>
                
                <li rel="/coder957/2017/10/10/基于XMl的DI-02/index.html" class="item ">
                    <a href="/coder957/comment/" title="留言" class="icon-comment">&nbsp;留言</a>
                </li>
                
        </ul>
        <div class="profile clearfix">
            <div class="feeds fl">
                
                    
                        <p class="links">
                            
                                <a href="https://github.com/FutaoSmile" target="_blank">
                                    Github
                                </a>
                                |
                                    
                                        
                                <a href="http://www.jianshu.com/u/9e2e579df7dd" target="_blank">
                                    简书
                                </a>
                                
                                        
                        </p>
                        <p class="sns">
                            
                                <a href="http://weibo.com/u/2379076265?refer_flag=1001030001_&amp;nick=FutaoSmile%E4%B8%B6" class="sinaweibo" target="_blank"><b>■</b> 新浪微博</a>
                                
                                <a href="https://gitee.com/FutaoSmile" class="qqweibo" target="_blank"><b>■</b> 码云</a>
                                
                                    <!-- <a href="javascript: void(0);" class="wechat">
                        <b>■</b>
                        公众号
                        <span class="popover">
                            <img src="/coder957/img/wechat_mp.jpg" width="120" height="120" alt="我的微信订阅号">
                            <i class="arrow"></i>
                        </span>
                    </a> -->
                        </p>
                        
            </div>
            <div class="avatar fr">
                <img src="/coder957/img/head.png" alt="avatar" title="Jelon">
            </div>
        </div>
    </section>
</header>

    <!-- 博客正文 -->
    <div class="container body clearfix">
        <section class="content">
            <div class="content-main widget">
                <!-- 文章页 -->
<!-- 文章 -->
<article class="post article">
    <header class="text-center">
        <h3 class="post-title"><span>基于XML的DI-02</span></h3>
    </header>
    <p class="post-meta text-center">
        FutaoSmile丶 发表于
            <time datetime="2017-10-10T06:23:30.529Z">2017-10-10</time>
    </p>
    <div class="post-content">
        <p>des…</p>
<blockquote>
<p>基于XMl的DI<br>1.集合属性注入<br>2.array数组属性注入<br>3.List&lt;&gt;属性注入<br>4.Set&lt;&gt;属性注入<br>5.Map<k,v>属性注入<br>6.Properties属性注入<br>7.autowire自动注入<br>8.SPEL注入</k,v></p>
</blockquote>
<a id="more"></a>
<p><strong>School类</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div></pre></td><td class="code"><pre><div class="line">package Part02.collectionDI;</div><div class="line"></div><div class="line">/**</div><div class="line"> * Created by futao on 2017/10/10.</div><div class="line"> */</div><div class="line">public class School &#123;</div><div class="line">    private String name;</div><div class="line"></div><div class="line">    public String getName() &#123;</div><div class="line">        return name;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setName(String name) &#123;</div><div class="line">        this.name = name;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    @Override</div><div class="line">    public String toString() &#123;</div><div class="line">        return &quot;School&#123;&quot; +</div><div class="line">                &quot;name=&apos;&quot; + name + &apos;\&apos;&apos; +</div><div class="line">                &apos;&#125;&apos;;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>Some类</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div></pre></td><td class="code"><pre><div class="line">package Part02.collectionDI;</div><div class="line"></div><div class="line"></div><div class="line">import java.util.*;</div><div class="line"></div><div class="line">/**</div><div class="line"> * Created by futao on 2017/10/10.</div><div class="line"> */</div><div class="line">public class Some &#123;</div><div class="line">    private School[] schools;</div><div class="line">    private List&lt;String&gt; myList;</div><div class="line">    private Set&lt;String&gt; mySet;</div><div class="line">    private Map&lt;String,Object&gt; myMap;</div><div class="line">    private Properties myPro;</div><div class="line"></div><div class="line">    public void setSchools(School[] schools) &#123;</div><div class="line">        this.schools = schools;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setMyList(List&lt;String&gt; myList) &#123;</div><div class="line">        this.myList = myList;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setMySet(Set&lt;String&gt; mySet) &#123;</div><div class="line">        this.mySet = mySet;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setMyMap(Map&lt;String, Object&gt; myMap) &#123;</div><div class="line">        this.myMap = myMap;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setMyPro(Properties myPro) &#123;</div><div class="line">        this.myPro = myPro;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    @Override</div><div class="line">    public String toString() &#123;</div><div class="line">        return &quot;Some&#123;&quot; +</div><div class="line">                &quot;schools=&quot; + Arrays.toString(schools) +</div><div class="line">                &quot;, myList=&quot; + myList +</div><div class="line">                &quot;, mySet=&quot; + mySet +</div><div class="line">                &quot;, myMap=&quot; + myMap +</div><div class="line">                &quot;, myPro=&quot; + myPro +</div><div class="line">                &apos;&#125;&apos;;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>配置文件applicationContextcollectionDI.xml</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div></pre></td><td class="code"><pre><div class="line">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</div><div class="line">&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;</div><div class="line">       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</div><div class="line">       xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd&quot;&gt;</div><div class="line">   &lt;bean id=&quot;some&quot; class=&quot;Part02.collectionDI.Some&quot;&gt;</div><div class="line">        &lt;!--数组--&gt;</div><div class="line">       &lt;property name=&quot;schools&quot;&gt;</div><div class="line">           &lt;array&gt;</div><div class="line">               &lt;ref bean=&quot;school1&quot;/&gt;</div><div class="line">               &lt;ref bean=&quot;school2&quot;/&gt;</div><div class="line">               &lt;ref bean=&quot;school2&quot;/&gt;</div><div class="line">               &lt;ref bean=&quot;school2&quot;/&gt;</div><div class="line">           &lt;/array&gt;</div><div class="line">       &lt;/property&gt;</div><div class="line"></div><div class="line">       &lt;!--list--&gt;</div><div class="line">       &lt;property name=&quot;myList&quot;&gt;</div><div class="line">           &lt;list&gt;</div><div class="line">               &lt;value&gt;张三&lt;/value&gt;</div><div class="line">               &lt;value&gt;李四&lt;/value&gt;</div><div class="line">               &lt;value&gt;王五&lt;/value&gt;</div><div class="line">           &lt;/list&gt;</div><div class="line">       &lt;/property&gt;</div><div class="line">       &lt;!--这种方式myList的长度为1，value里面的值会被当成一个值--&gt;</div><div class="line">       &lt;!--&lt;property name=&quot;myList&quot; value=&quot;张三,李四,王五&quot;/&gt;--&gt;</div><div class="line"></div><div class="line">       &lt;!--set--&gt;</div><div class="line">       &lt;property name=&quot;mySet&quot;&gt;</div><div class="line">           &lt;set&gt;</div><div class="line">               &lt;value&gt;北京&lt;/value&gt;</div><div class="line">               &lt;value&gt;上海&lt;/value&gt;</div><div class="line">               &lt;value&gt;南昌&lt;/value&gt;</div><div class="line">           &lt;/set&gt;</div><div class="line">       &lt;/property&gt;</div><div class="line">       &lt;!--这种方式mySet的长度为1，value里面的值会被当成一个值--&gt;</div><div class="line">       &lt;!--&lt;property name=&quot;mySet&quot; value=&quot;北京，上海，南昌&quot;/&gt;--&gt;</div><div class="line"></div><div class="line">       &lt;!--map--&gt;</div><div class="line">       &lt;property name=&quot;myMap&quot;&gt;</div><div class="line">           &lt;map&gt;</div><div class="line">               &lt;entry key=&quot;k1&quot; value-ref=&quot;school1&quot;/&gt;</div><div class="line">               &lt;entry key=&quot;k2&quot; value-ref=&quot;school2&quot;/&gt;</div><div class="line">               &lt;entry key=&quot;k3&quot; value-ref=&quot;school2&quot;/&gt;</div><div class="line">               &lt;entry key=&quot;k4&quot; value-ref=&quot;school2&quot;/&gt;</div><div class="line">               &lt;entry key=&quot;k5&quot; value=&quot;wechat&quot;/&gt;</div><div class="line">           &lt;/map&gt;</div><div class="line">       &lt;/property&gt;</div><div class="line"></div><div class="line">       &lt;property name=&quot;myPro&quot;&gt;</div><div class="line">           &lt;props&gt;</div><div class="line">               &lt;prop key=&quot;地址1&quot;&gt;上海市&lt;/prop&gt;</div><div class="line">               &lt;prop key=&quot;地址2&quot;&gt;闵行区&lt;/prop&gt;</div><div class="line">               &lt;prop key=&quot;地址3&quot;&gt;吴泾镇&lt;/prop&gt;</div><div class="line">               &lt;prop key=&quot;地址4&quot;&gt;紫竹&lt;/prop&gt;</div><div class="line">               &lt;prop key=&quot;地址5&quot;&gt;数码港&lt;/prop&gt;</div><div class="line">           &lt;/props&gt;</div><div class="line">       &lt;/property&gt;</div><div class="line"></div><div class="line">   &lt;/bean&gt;</div><div class="line"></div><div class="line">    &lt;bean id=&quot;school1&quot; class=&quot;Part02.collectionDI.School&quot;&gt;</div><div class="line">        &lt;property name=&quot;name&quot; value=&quot;Ecjtu&quot;&gt;&lt;/property&gt;</div><div class="line">    &lt;/bean&gt;</div><div class="line">    &lt;bean id=&quot;school2&quot; class=&quot;Part02.collectionDI.School&quot;&gt;</div><div class="line">        &lt;property name=&quot;name&quot; value=&quot;NCDX&quot;&gt;&lt;/property&gt;</div><div class="line">    &lt;/bean&gt;</div><div class="line">&lt;/beans&gt;</div></pre></td></tr></table></figure></p>
<p><strong>测试</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">/**</div><div class="line">    * 基于XML的DI-集合属性注入</div><div class="line">    */</div><div class="line">   @Test</div><div class="line">   fun test4collections()&#123;</div><div class="line">       val classPathXmlApplicationContext = ClassPathXmlApplicationContext(&quot;applicationContextcollectionDI.xml&quot;)</div><div class="line">       val some = classPathXmlApplicationContext.getBean(&quot;some&quot;) as Some</div><div class="line">       println(GsonBuilder().setPrettyPrinting().create().toJson(some))</div><div class="line">   &#125;</div></pre></td></tr></table></figure></p>
<p><strong>结果</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">  &quot;schools&quot;: [</div><div class="line">    &#123;</div><div class="line">      &quot;name&quot;: &quot;Ecjtu&quot;</div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      &quot;name&quot;: &quot;NCDX&quot;</div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      &quot;name&quot;: &quot;NCDX&quot;</div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      &quot;name&quot;: &quot;NCDX&quot;</div><div class="line">    &#125;</div><div class="line">  ],</div><div class="line">  &quot;myList&quot;: [</div><div class="line">    &quot;张三&quot;,</div><div class="line">    &quot;李四&quot;,</div><div class="line">    &quot;王二&quot;</div><div class="line">  ],</div><div class="line">  &quot;mySet&quot;: [</div><div class="line">    &quot;北京&quot;,</div><div class="line">    &quot;上海&quot;,</div><div class="line">    &quot;南昌&quot;</div><div class="line">  ],</div><div class="line">  &quot;myMap&quot;: &#123;</div><div class="line">    &quot;k1&quot;: &#123;</div><div class="line">      &quot;name&quot;: &quot;Ecjtu&quot;</div><div class="line">    &#125;,</div><div class="line">    &quot;k2&quot;: &#123;</div><div class="line">      &quot;name&quot;: &quot;NCDX&quot;</div><div class="line">    &#125;,</div><div class="line">    &quot;k3&quot;: &#123;</div><div class="line">      &quot;name&quot;: &quot;NCDX&quot;</div><div class="line">    &#125;,</div><div class="line">    &quot;k4&quot;: &#123;</div><div class="line">      &quot;name&quot;: &quot;NCDX&quot;</div><div class="line">    &#125;,</div><div class="line">    &quot;k5&quot;: &quot;wechat&quot;</div><div class="line">  &#125;,</div><div class="line">  &quot;myPro&quot;: &#123;</div><div class="line">    &quot;地址3&quot;: &quot;吴泾镇&quot;,</div><div class="line">    &quot;地址2&quot;: &quot;闵行区&quot;,</div><div class="line">    &quot;地址1&quot;: &quot;上海市&quot;,</div><div class="line">    &quot;地址5&quot;: &quot;数码港&quot;,</div><div class="line">    &quot;地址4&quot;: &quot;紫竹&quot;</div><div class="line">  &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<h3 id="autowire自动装配"><a href="#autowire自动装配" class="headerlink" title="autowire自动装配"></a>autowire自动装配</h3><p><strong>School类</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div></pre></td><td class="code"><pre><div class="line">package Part02.autoDIbyNameForDomain;</div><div class="line"></div><div class="line">/**</div><div class="line"> * Created by futao on 2017/10/10.</div><div class="line"> */</div><div class="line">public class School &#123;</div><div class="line">    private String name;</div><div class="line"></div><div class="line">    public String getName() &#123;</div><div class="line">        return name;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setName(String name) &#123;</div><div class="line">        this.name = name;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    @Override</div><div class="line">    public String toString() &#123;</div><div class="line">        return &quot;School&#123;&quot; +</div><div class="line">                &quot;name=&apos;&quot; + name + &apos;\&apos;&apos; +</div><div class="line">                &apos;&#125;&apos;;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>Student类</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div></pre></td><td class="code"><pre><div class="line">package Part02.autoDIbyNameForDomain;</div><div class="line"></div><div class="line">/**</div><div class="line"> * Created by futao on 2017/10/10.</div><div class="line"> */</div><div class="line">public class Student &#123;</div><div class="line">    private String name;</div><div class="line">    private int age;</div><div class="line">    private String address;</div><div class="line">    private School school;</div><div class="line"></div><div class="line">    public String getName() &#123;</div><div class="line">        return name;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setName(String name) &#123;</div><div class="line">        this.name = name;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public int getAge() &#123;</div><div class="line">        return age;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setAge(int age) &#123;</div><div class="line">        this.age = age;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public String getAddress() &#123;</div><div class="line">        return address;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setAddress(String address) &#123;</div><div class="line">        this.address = address;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public School getSchool() &#123;</div><div class="line">        return school;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setSchool(School school) &#123;</div><div class="line">        this.school = school;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public Student() &#123;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public Student(String name, int age, String address, School school) &#123;</div><div class="line">        this.name = name;</div><div class="line">        this.age = age;</div><div class="line">        this.address = address;</div><div class="line">        this.school = school;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    @Override</div><div class="line">    public String toString() &#123;</div><div class="line">        return &quot;Student&#123;&quot; +</div><div class="line">                &quot;name=&apos;&quot; + name + &apos;\&apos;&apos; +</div><div class="line">                &quot;, age=&quot; + age +</div><div class="line">                &quot;, address=&apos;&quot; + address + &apos;\&apos;&apos; +</div><div class="line">                &quot;, school=&quot; + school +</div><div class="line">                &apos;&#125;&apos;;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>applicationContext.xml</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</div><div class="line">&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;</div><div class="line">       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</div><div class="line">       xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd&quot;&gt;</div><div class="line">    &lt;bean id=&quot;school1&quot; class=&quot;Part02.autoDIbyNameForDomain.School&quot;&gt;</div><div class="line">        &lt;property name=&quot;name&quot; value=&quot;上海交通大学&quot;/&gt;</div><div class="line">    &lt;/bean&gt;</div><div class="line"></div><div class="line">    &lt;bean id=&quot;student&quot; class=&quot;Part02.autoDIbyNameForDomain.Student&quot; autowire=&quot;byName&quot;&gt;</div><div class="line">        &lt;property name=&quot;age&quot; value=&quot;18&quot;/&gt;</div><div class="line">        &lt;property name=&quot;address&quot; value=&quot;Shanghai&quot;/&gt;</div><div class="line">    &lt;/bean&gt;</div><div class="line">&lt;/beans&gt;</div></pre></td></tr></table></figure></p>
<p><strong>测试</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line"> /**</div><div class="line">     * 基于XML的DI-byName方式的域属性自动注入</div><div class="line">     */</div><div class="line">    @Test</div><div class="line">    fun test4autoDIbyNamefordomain() &#123;</div><div class="line">        val classPathXmlApplicationContext = ClassPathXmlApplicationContext(&quot;applicationContextautoDIbyNameForDomain.xml&quot;)</div><div class="line">        val student = classPathXmlApplicationContext.getBean(&quot;student&quot;) as Part02.autoDIbyNameForDomain.Student</div><div class="line">//        serializeNulls()-&gt;为null的值也显示出来，setPrettyPrinting()-&gt;格式化控制台输出</div><div class="line">        println(GsonBuilder().serializeNulls().setPrettyPrinting().create().toJson(student))</div><div class="line">        println(student)</div><div class="line">    &#125;</div></pre></td></tr></table></figure></p>
<p><strong>结果</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">  &quot;name&quot;: null,</div><div class="line">  &quot;age&quot;: 18,</div><div class="line">  &quot;address&quot;: &quot;Shanghai&quot;,</div><div class="line">  &quot;school&quot;: null</div><div class="line">&#125;</div><div class="line">Student&#123;name=&apos;null&apos;, age=18, address=&apos;Shanghai&apos;, school=null&#125;</div></pre></td></tr></table></figure></p>
<p><em>others</em></p>
<blockquote>
<p>在xml配置文件中，autowire有5种类型，可以在<bean>元素中使用autowire属性指定</bean></p>
</blockquote>
<p><table><br>    <tr><br>        <td>模式</td><br>        <td>说明</td><br>    </tr><br>    <tr><br>        <td>no</td><br>        <td>不使用自动装配，必须通过ref元素指定依赖，默认设置。</td><br>    </tr><br>    <tr><br>        <td>byName</td><br>        <td> 根据属性名自动装配。此选项将检查容器并根据名字查找与属性完全一致的bean，并将其与属性自动装配。</td><br>    </tr><br>    <tr><br>        <td>byType</td><br>        <td> 如果容器中存在一个与指定属性类型相同的bean，那么将与该属性自动装配；如果存在多个该类型bean，那么抛出异常，并指出不能使用byType方式进行自动装配；如果没有找到相匹配的bean，则什么事都不发生，也可以通过设置dependency-check=”objects”让Spring抛出异常。</td><br>    </tr><br>    <tr><br>        <td>constructor</td><br>        <td>与byType方式类似，不同之处在于它应用于构造器参数。如果容器中没有找到与构造器参数类型一致的bean，那么抛出异常。</td><br>    </tr><br>    <tr><br>        <td>autodetect </td><br>        <td>通过bean类的自省机制（introspection）来决定是使用constructor还是byType方式进行自动装配。如果发现默认的构造器，那么将使用byType方式。 </td><br>    </tr><br></table><br>可以设置bean使自动装配失效：<br>采用xml格式配置bean时，将<code>&lt;bean/&gt;</code>元素的autowire-candidate属性设置为false，这样容器在查找自动装配对象时，将不考虑该bean，即它不会被考虑作为其它bean自动装配的候选者，但是该bean本身还是可以使用自动装配来注入其它bean的。</p>
<p><strong>需要注意以下情况：</strong><br><em>autowird=”byType” (type-&gt;A)<br>B extends A<br>A是一个bean<br>如果此时B也是一个bean，则会报错，该类型（A）的bean不止一个。<br>因为A a=new B()<br>B类型也可以作为A类型根据autowird=”byType”进行注入</em></p>
<h2 id="SPEL注入"><a href="#SPEL注入" class="headerlink" title="SPEL注入"></a>SPEL注入</h2><p><strong>Person类</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div></pre></td><td class="code"><pre><div class="line">package Part02.SPELDI;</div><div class="line"></div><div class="line">/**</div><div class="line"> * Created by futao on 2017/10/11.</div><div class="line"> */</div><div class="line">public class Person &#123;</div><div class="line">    /**</div><div class="line">     * 姓名</div><div class="line">     */</div><div class="line">    private String pname;</div><div class="line">    /**</div><div class="line">     * 年龄</div><div class="line">     */</div><div class="line">    private int page;</div><div class="line"></div><div class="line">    /**</div><div class="line">     * 带参构造方法</div><div class="line">     *</div><div class="line">     * @param pname 姓名</div><div class="line">     * @param page  年龄</div><div class="line">     */</div><div class="line">    public Person(String pname, int page) &#123;</div><div class="line">        this.pname = pname;</div><div class="line">        this.page = page;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public Person() &#123;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public String getPname() &#123;</div><div class="line">        return pname;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setPname(String pname) &#123;</div><div class="line">        this.pname = pname;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public int getPage() &#123;</div><div class="line">        return page;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setPage(int page) &#123;</div><div class="line">        this.page = page;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    @Override</div><div class="line">    public String toString() &#123;</div><div class="line">        return &quot;Person&#123;&quot; +</div><div class="line">                &quot;pname=&apos;&quot; + pname + &apos;\&apos;&apos; +</div><div class="line">                &quot;, page=&quot; + page +</div><div class="line">                &apos;&#125;&apos;;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    /**</div><div class="line">     * 控制年龄</div><div class="line">     *</div><div class="line">     * @return</div><div class="line">     */</div><div class="line">    public int calculateAge() &#123;</div><div class="line">        return page &gt; 25 ? 25 : page;</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>Student类</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div></pre></td><td class="code"><pre><div class="line">package Part02.SPELDI;</div><div class="line"></div><div class="line">/**</div><div class="line"> * Created by futao on 2017/10/12.</div><div class="line"> */</div><div class="line">public class Student &#123;</div><div class="line">    private String sname;</div><div class="line">    private int sage;</div><div class="line"></div><div class="line">    public String getSname() &#123;</div><div class="line">        return sname;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setSname(String sname) &#123;</div><div class="line">        this.sname = sname;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public int getSage() &#123;</div><div class="line">        return sage;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    public void setSage(int sage) &#123;</div><div class="line">        this.sage = sage;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    @Override</div><div class="line">    public String toString() &#123;</div><div class="line">        return &quot;Student&#123;&quot; +</div><div class="line">                &quot;sname=&apos;&quot; + sname + &apos;\&apos;&apos; +</div><div class="line">                &quot;, sage=&quot; + sage +</div><div class="line">                &apos;&#125;&apos;;</div><div class="line">    &#125;</div><div class="line"></div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>配置文件</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div></pre></td><td class="code"><pre><div class="line">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</div><div class="line">&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;</div><div class="line">       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</div><div class="line">       xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd&quot;&gt;</div><div class="line">    &lt;bean id=&quot;person&quot; class=&quot;Part02.SPELDI.Person&quot;&gt;</div><div class="line">        &lt;property name=&quot;pname&quot; value=&quot;老三&quot;/&gt;</div><div class="line">        &lt;property name=&quot;page&quot; value=&quot;#&#123;T(java.lang.Math).random()*50&#125;&quot;/&gt;</div><div class="line">    &lt;/bean&gt;</div><div class="line">    &lt;bean id=&quot;student&quot; class=&quot;Part02.SPELDI.Student&quot;&gt;</div><div class="line">        &lt;property name=&quot;sname&quot; value=&quot;#&#123;person.pname&#125;&quot;/&gt;</div><div class="line">        &lt;!--&lt;property name=&quot;sage&quot; value=&quot;#&#123;person.page &gt; 25 ? 25:person.page&#125;&quot;/&gt;--&gt;</div><div class="line">        &lt;property name=&quot;sage&quot; value=&quot;#&#123;person.calculateAge()&#125;&quot;/&gt;</div><div class="line">    &lt;/bean&gt;</div><div class="line">&lt;/beans&gt;</div></pre></td></tr></table></figure></p>
<p><strong>测试</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div></pre></td><td class="code"><pre><div class="line">/**</div><div class="line"> * SPEL注入</div><div class="line"> */</div><div class="line">@Test</div><div class="line">fun test4SPEL()&#123;</div><div class="line">    val classPathXmlApplicationContext = ClassPathXmlApplicationContext(&quot;applicationContextSPEL.xml&quot;)</div><div class="line">    val student = classPathXmlApplicationContext.getBean(&quot;student&quot;) as Part02.SPELDI.Student</div><div class="line">    val person = classPathXmlApplicationContext.getBean(&quot;person&quot;) as Person</div><div class="line">    println(GsonBuilder().serializeNulls().setPrettyPrinting().create().toJson(student))</div><div class="line">    println(GsonBuilder().serializeNulls().setPrettyPrinting().create().toJson(person))</div><div class="line"></div><div class="line">    student.sage=666</div><div class="line">    println(GsonBuilder().serializeNulls().setPrettyPrinting().create().toJson(student))</div><div class="line">    println(GsonBuilder().serializeNulls().setPrettyPrinting().create().toJson(person))</div><div class="line"></div><div class="line">    person.page=999</div><div class="line">    println(GsonBuilder().serializeNulls().setPrettyPrinting().create().toJson(student))</div><div class="line">    println(GsonBuilder().serializeNulls().setPrettyPrinting().create().toJson(person))</div><div class="line"></div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p><strong>结果</strong><br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">  &quot;sname&quot;: &quot;老三&quot;,</div><div class="line">  &quot;sage&quot;: 25</div><div class="line">&#125;</div><div class="line">&#123;</div><div class="line">  &quot;pname&quot;: &quot;老三&quot;,</div><div class="line">  &quot;page&quot;: 29</div><div class="line">&#125;</div><div class="line">&#123;</div><div class="line">  &quot;sname&quot;: &quot;老三&quot;,</div><div class="line">  &quot;sage&quot;: 666</div><div class="line">&#125;</div><div class="line">&#123;</div><div class="line">  &quot;pname&quot;: &quot;老三&quot;,</div><div class="line">  &quot;page&quot;: 29</div><div class="line">&#125;</div><div class="line">&#123;</div><div class="line">  &quot;sname&quot;: &quot;老三&quot;,</div><div class="line">  &quot;sage&quot;: 666</div><div class="line">&#125;</div><div class="line">&#123;</div><div class="line">  &quot;pname&quot;: &quot;老三&quot;,</div><div class="line">  &quot;page&quot;: 999</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<h3 id="tips"><a href="#tips" class="headerlink" title="tips:"></a>tips:</h3><p>如果一个类有带参的构造函数，而没有无参的构造函数，那么在注册bean的时候必须使用构造注入。</p>

    </div>
    <p class="post-meta">
        <span class="post-cat">分类：
            <a class="cat-link" href="/coder957/categories/后端/">后端</a>|<a class="cat-link" href="/coder957/categories/后端/Java/">Java</a>
        </span>
        <span class="post-tags">
            标签：
            
    
        <a href="/coder957/tags/Java/" title="Java">Java</a> / 
    
        <a href="/coder957/tags/Spring/" title="Spring">Spring</a> / 
    
        <a href="/coder957/tags/kotlin/" title="kotlin">kotlin</a>
    

        </span>
    </p>
</article>
<!-- 分享按钮 -->

  <div class="article-share clearfix text-center">
    <div class="share-area">
      <span class="share-txt">分享到：</span>
      <a href="javascript: window.open('http://service.weibo.com/share/share.php?url=' + encodeURIComponent(location.href) + '&title=' + document.title + '&language=zh_cn');" class="share-icon weibo"></a>
      <a href="javascript: alert('请复制链接到微信并发送');" class="share-icon wechat"></a>
      <a href="javascript: window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + encodeURIComponent(location.href) + '&title=' + document.title);" class="share-icon qqzone"></a>
      <a href="javascript: window.open('http://connect.qq.com/widget/shareqq/index.html?url=' + encodeURIComponent(location.href) + '&desc=Jelon个人博客&title=' + document.title + '&callback=' + encodeURIComponent(location.href));" class="share-icon qq"></a>
      <a href="javascript: window.open('http://shuo.douban.com/!service/share?href=' + encodeURIComponent(location.href) + '&name=' + document.title + '&text=' + document.title);" class="share-icon douban"></a>
    </div>
  </div>


    <!-- 上一篇/下一篇 -->

<div class="article-nav clearfix">
    
    <span class="prev fl">
        上一篇<br >
        <a href="/coder957/2017/10/12/进程和线程/">
            
                进程和线程
            
        </a>
    </span>
    

    
    <span class="next fr">
        下一篇<br >
        <a href="/coder957/2017/10/10/基于XML的DI-01/">
            
                基于XML的DI-01
            
        </a>
    </span>
    
</div>

        <!-- 文章评论 -->
        
  <script src="/coder957/js/comment.js"></script>
  <div id="comments" class="comment">
    <!--
    <div class="sign-bar">
      GitHub 已登录!
      <span class="sign-link">登出</span>
    </div>
    <section class="box">
      <div class="com-avatar"><img src="/img/jelon.jpg" alt="avatar"></div>
      <div class="com-text">
        <div class="main">
          <textarea class="text-area-edited show" placeholder="欢迎评论！"></textarea>
          <div class="text-area-preview"></div>
        </div>
        <div class="switch">
          <div class="switch-item on">编辑</div>
          <div class="switch-item">预览</div>
        </div>
        <div class="button">提交</div>
      </div>
    </section>
    <section class="tips">注：评论支持 markdown 语法！</section>
    <section class="list-wrap">
      <ul class="list">
        <li>
          <div class="user-avatar">
            <a href="/">
              <img src="/img/jelon.jpg" alt="user-avatar">
            </a>
          </div>
          <div class="user-comment">
            <div class="user-comment-header">
              <span class="post-name">张德龙</span>
              <span class="post-time">2017年12月12日</span>
              <span class="like liked">已赞</span>
              <span class="like-num">2</span>
            </div>
            <div class="user-comment-body">333333</div>
          </div>
        </li>
        <li>
          <div class="user-avatar">
            <a href="/">
              <img src="/img/jelon.jpg" alt="user-avatar">
            </a>
          </div>
          <div class="user-comment">
            <div class="user-comment-header">
              <span class="post-name">刘德华</span>
              <span class="post-time">2017年12月12日</span>
              <span class="like">点赞</span>
              <span class="like-num">2</span>
            </div>
            <div class="user-comment-body">vvvvv</div>
          </div>
        </li>
      </ul>
      <div class="page-nav">
        <a href="javascript: void(0);" class="item">1</a>
        <a href="javascript: void(0);" class="item">2</a>
        <a href="javascript: void(0);" class="item current">3</a>
      </div>
    </section>
    -->
  </div>
  <script>
  JELON.Comment({
    container: 'comments',
    label: '基于XMl的DI-02' || '2017/10/10/基于XMl的DI-02/',
    owner: 'FutaoSmile',
    repo: 'blog_comments',
    clientId: '149ec394071cfd7f0f47',
    clientSecret: 'd1c988f53efa3f0f8651799f8212cc8e2cab24b9'
  });
  </script>


            </div>

        </section>
        <!-- 侧栏部分 -->
<aside class="sidebar">
    <section class="widget">
        <h3 class="widget-hd"><strong>文章分类</strong></h3>
        <!-- 文章分类 -->
<ul class="widget-bd">
    
    <li>
        <a href="/coder957/categories/后端/">后端</a>
        <span class="badge">(5)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/Java/">Java</a>
        <span class="badge">(8)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/Web技术/">Web技术</a>
        <span class="badge">(3)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/后端/Java/">Java</a>
        <span class="badge">(5)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/GIt/">GIt</a>
        <span class="badge">(1)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/Java/Spring/">Spring</a>
        <span class="badge">(3)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/Java/学习/">学习</a>
        <span class="badge">(5)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/Web技术/Java/">Java</a>
        <span class="badge">(1)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/Web技术/Kotlin/">Kotlin</a>
        <span class="badge">(1)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/GIt/Web技术/">Web技术</a>
        <span class="badge">(1)</span>
    </li>
    
    <li>
        <a href="/coder957/categories/学习/">学习</a>
        <span class="badge">(1)</span>
    </li>
    
</ul>
    </section>

    
    <section class="widget">
        <h3 class="widget-hd"><strong>热门标签</strong></h3>
        <!-- 文章标签 -->
<div class="widget-bd tag-wrap">
  
    <a class="tag-item" href="/coder957/tags/Java/" title="Java">Java (12)</a>
  
    <a class="tag-item" href="/coder957/tags/Spring/" title="Spring">Spring (9)</a>
  
    <a class="tag-item" href="/coder957/tags/kotlin/" title="kotlin">kotlin (7)</a>
  
    <a class="tag-item" href="/coder957/tags/Maven/" title="Maven">Maven (2)</a>
  
    <a class="tag-item" href="/coder957/tags/Hibernate/" title="Hibernate">Hibernate (2)</a>
  
    <a class="tag-item" href="/coder957/tags/kotlin-小知识/" title="kotlin 小知识">kotlin 小知识 (1)</a>
  
    <a class="tag-item" href="/coder957/tags/Kotlin/" title="Kotlin">Kotlin (1)</a>
  
    <a class="tag-item" href="/coder957/tags/Json/" title="Json">Json (1)</a>
  
    <a class="tag-item" href="/coder957/tags/热点文章/" title="热点文章">热点文章 (1)</a>
  
    <a class="tag-item" href="/coder957/tags/博主推荐/" title="博主推荐">博主推荐 (1)</a>
  
    <a class="tag-item" href="/coder957/tags/转载/" title="转载">转载 (1)</a>
  
    <a class="tag-item" href="/coder957/tags/资料/" title="资料">资料 (1)</a>
  
    <a class="tag-item" href="/coder957/tags/Ajax/" title="Ajax">Ajax (1)</a>
  
</div>
    </section>
    

    

    
    <!-- 友情链接 -->
    <section class="widget">
        <h3 class="widget-hd"><strong>友情链接</strong></h3>
        <!-- 文章分类 -->
<ul class="widget-bd">
    
        <li>
            <a href="http://lsc95.github.io/" target="_blank" title="椿哥的狗窝">椿哥的狗窝</a>
        </li>
    
        <li>
            <a href="http://futaosmile.oschina.io/documents/" target="_blank" title="donot click me">Document</a>
        </li>
    
        <li>
            <a href="" target="_blank" title="虚位以待">loading...</a>
        </li>
    
</ul>
    </section>
    
</aside>
<!-- / 侧栏部分 -->
    </div>

    <!-- 博客底部 -->
    <footer class="footer">
    &copy;
    
                2016-
                2017
                    

                        <a href="/coder957/">Loves You</a>
</footer>
<div class="back-to-top" id="JELON__backToTop" title="返回顶部">返回顶部</div>
    <!--博客js脚本 -->
    <!-- 这里放网站js脚本 -->
<script src="/coder957/js/main.js"></script>
</body>
</html>